package ${package.ServiceImpl};


import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};

import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.xiaoxi.bms.common.exception.BMSException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * @ClassName ${table.serviceImplName}
 * @Description
 * @Author ${author}
 * @Date ${date}
 * @Version 1.0
 */
@Service
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

    @Override
    public IPage<${entity}> findListByPage(${entity} ${entity?uncap_first},Pageable pageable) {

        IPage<${entity}> iPage = new Page<>(pageable.getPageNumber(), pageable.getPageSize());

        QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();

        return baseMapper.selectPage(iPage, queryWrapper);
    }

    @Override
    public void add(${entity} ${entity?uncap_first}) throws BMSException {
        baseMapper.insert(${entity?uncap_first});
    }

    @Override
    public void delete(Long id) throws BMSException {
        baseMapper.deleteById(id);
    }

    @Override
    public void update(${entity} ${entity?uncap_first}) throws BMSException {
        baseMapper.updateById(${entity?uncap_first});
    }

    @Override
    public ${entity} findById(Long id) {
        return baseMapper.selectById(id);
    }
}
